from PIL.ImageQt import QPixmap
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton, QWidget, QVBoxLayout, QLabel
# DOC： 1.导入qrc编译后的资源文件
import resources.R01_learn
import sys

class MyWindow(QWidget):
    def __init__(self) -> None:
        super().__init__()
        self.setWindowTitle("MyWindow")
        button = QPushButton("Press me")

        self.label = QLabel()
        # DOC：2.使用编译后的资源文件（最好是通过别名引用）
        self.label.setPixmap(QPixmap(':/images/dan.jpg'))

        self.layout = QVBoxLayout()
        self.layout.addWidget(button)
        self.layout.addWidget(self.label)
        self.setLayout(self.layout)

if __name__ == '__main__':
    app = QApplication(sys.argv)

    window = MyWindow()
    window.show()

    app.exec()